Skip to content

fix(auth): remove console.log of OAuth state tokens in auth.ts#291

Open
hariom888 wants to merge 1 commit into
Dev-Card:mainfrom
hariom888:fix-oauth-state-token-logging
Open

fix(auth): remove console.log of OAuth state tokens in auth.ts#291
hariom888 wants to merge 1 commit into
Dev-Card:mainfrom
hariom888:fix-oauth-state-token-logging

Conversation

@hariom888
Copy link
Copy Markdown

Problem

Few lines in apps/backend/src/routes/auth.ts call console.log with the full OAuth redirect URL, which includes the
state token. State tokens are CSRF protection secrets and must not appear in logs. This also bypasses Fastify's pino logger,
breaking structured logging and level-based filtering in production. All other paths in the codebase correctly use app.log.error.

Fix

  • Removed all 4 console.log lines from the /github and /google handlers
  • Replaced with app.log.debug({ provider: '...' }, 'OAuth redirect initiated')
  • No URL or state token is logged
  • Uses Fastify's pino logger consistently with the rest of the codebase

Testing

  • Existing test suite passes
  • console.log is no longer called during OAuth initiation

Closes #202

@Harxhit Harxhit added the gssoc:approved Required label for every approved PR. Gives the base +50 points and enables contribution tracking. label May 23, 2026
@Prince2301p
Copy link
Copy Markdown

Hi,
I would like to work on resolving this issue. Please assign it to me. I’m a participant in GSSoC 2026 and would be happy to contribute.
Looking forward to collaborating with you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved Required label for every approved PR. Gives the base +50 points and enables contribution tracking.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OAuth redirect URLs are console.log'd to stdout in production — leaks state tokens to server logs

3 participants